<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>绘制文字</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0
    }
</style>

<body>
    <canvas id="canvas" width="500" height="500"></canvas>
    <script>
        var dom = document.getElementById('canvas'),
            ctx = dom.getContext('2d');
        ctx.font="Bold 40px Arial";
        ctx.fillStyle="#ff0066";
        ctx.fillText("hello world!!",100,100)
    </script>
</body>

</html>